file = open("m1_sorted.txt")
m1 = file.read().split()
file = open("m2_reverse.txt")
m2 = file.read().split()
file = open("m3_shuffle.txt")
m3 = file.read().split()
import timeit
def bubble_sort(nums):
    swapped = True
    while swapped:
        swapped = False
        for i in range(len(nums) - 1):
            if nums[i] > nums[i + 1]:
                nums[i], nums[i + 1] = nums[i + 1], nums[i]
                swapped = True
start_time = timeit.default_timer()
bubble_sort(m1)
t1 = timeit.default_timer() - start_time
print('m1_sorted', int(t1 * 1000), 'milliseconds')
start_time = timeit.default_timer()
bubble_sort(m2)
t2 = timeit.default_timer() - start_time
print('m2_reverse', int(t2 * 1000), 'milliseconds')
start_time = timeit.default_timer()
bubble_sort(m3)
t3 = timeit.default_timer() - start_time
print('m3_shuffle', int(t3 * 1000), 'milliseconds')